{% extends "layout.html" %}
{% load currency_filters %}
{% load i18n %}

{% block body_class %}account-pages{% endblock %}

{% block breadcrumbs %}
<ul class="breadcrumb">
    <li>
        <a href="{% url promotions:home %}">{% trans 'Home' %}</a>
        <span class="divider">/</span>
    </li>
    <li>
        <a href="{% url customer:summary %}">{% trans 'Account' %}</a>
        <span class="divider">/</span>
    </li>
    <li class="active">{% trans 'Order history' %}</li>
</ul>
{% endblock %}

{% block title %}
{% trans 'Order history' %} | {{ block.super }}
{% endblock %}

{% block headertext %}
{% trans 'Account' %}
{% endblock %}

{% block subnavigation %}
    {% include "partials/nav_profile.html" with order_history="active" %}
{% endblock %}

{% block subheader %}
<div class="sub-header">
    <h2>{% trans 'Order history' %}</h2>
</div>
{% endblock subheader %}

{% block content %}

<h3>{% trans 'Search in orders' %}</h3>
<form action="." method="get">
    {% include "partials/form_fields.html" with form=form %}
    <button type="submit" class="btn btn-primary">{% trans 'Filter results' %}</button>
    <a href="{% url customer:order-list %}" class="btn">{% trans 'Reset' %}</a>
</form>

<h3>{{ form.description }}</h3>
{% if orders %}
<table class="table table-striped table-bordered">
    <tr>
        <th>{% trans 'Order number' %}</th>
        <th>{% trans 'Total inc tax' %}</th>
        <th>{% trans 'Date submitted' %}</th>
        <th></th>
    </tr>
    {% for order in orders %}
    <tr>
        <td>{{ order.number }}</td>
        <td>{{ order.total_incl_tax|currency }}</td>
        <td>{{ order.date_placed }}</td>
        <td>
            <a class="btn btn-info" href="{% url customer:order order.number %}">{% trans 'View' %}</a>
            <form id="order_form_{{ order.id }}" action="{% url customer:order order.number %}" method="post">
                {% csrf_token %}
                <input type="hidden" name="order_id" value="{{ order.id }}" />
                <input type="hidden" name="action" value="reorder" />
                <!--<button type="submit" class="btn btn-success">{% trans 'Re-order' %}</button>-->
            </form>
        </td>
    </tr>
    {% endfor %}
</table>
{% else %}
<p>{% trans 'No orders found' %}</p>
{% endif %}

{% include "partials/pagination.html" %}

{% endblock content %}

